package com.caocaog.market.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.groups.UpdateGroup;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * App版本控制管理
 *
 * @author chechen
 * @date 2022-03-01
 */
@Data
@TableName("mk_app_version")
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "mk_app_version对象", description = "App版本控制管理")
public class AppVersion implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @NotNull(message = "更新时，id不能为空", groups = {UpdateGroup.class})
    @ApiModelProperty(value = "ID")
    private Integer id;

    @ApiModelProperty(value = "创建人", hidden = true)
    private String createBy;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间", hidden = true)
    private Date createTime;

    @ApiModelProperty(value = "更新人", hidden = true)
    private String updateBy;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间", hidden = true)
    private Date updateTime;

    @NotBlank(message = "版本号不能为空")
    @ApiModelProperty(value = "版本号")
    private String versionNumber;

    @NotBlank(message = "版本标题不能为空")
    @ApiModelProperty(value = "版本标题")
    private String title;

    @NotBlank(message = "安装包路径不能为空")
    @ApiModelProperty(value = "安装包路径")
    private String url;

    @NotNull(message = "版本类型不能为空")
    @Dict(dicCode = "app_version_type")
    @ApiModelProperty(value = "版本类型  1:客户端iOS 2：客户端Android 3：骑士端iOS 4：骑士端Android 5：商户端iOS 6：商户端Android")
    private Integer type;

    @ApiModelProperty(value = "备注")
    private String remark;

    @Dict(dicCode = "mk_whether")
    @ApiModelProperty(value = "是否强制更新 0：否 1：是，默认0")
    private Integer isForcedUpdate;

    @Dict(dicCode = "mk_whether")
    @ApiModelProperty(value = "是否使用 0：否  1：是，默认0")
    private Integer isUsing;

    @ApiModelProperty(value = "下载次数，默认0")
    private Integer downloadCount;

    @ApiModelProperty(value = "分站id集合，逗号分隔")
    private String siteIds;

    @ApiModelProperty(value = "用户id集合，逗号分隔")
    private String userIds;

    public void clearFields() {
        this.createBy = null;
        this.createTime = null;
        this.updateBy = null;
        this.updateTime = null;
    }

}
